package com.caogt.programmer.register.ctrl;

import com.programmer.common.entity.AnswerForm;
import com.programmer.common.entity.ResultData;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/register")
public class RegisterCtrl {

    @PostMapping("/submitQuestion")
    @ResponseBody
    public ResultData submitQuestion(List<AnswerForm> answerFormList){
        if(CollectionUtils.isEmpty(answerFormList)){
            return ResultData.fail("答案不能为空！");
        }
        answerFormList.forEach(answerForm -> {
            answerForm.getQuestionId();
        });

        return ResultData.success();
    }


    @GetMapping("/getQuestion")
    @ResponseBody
    public ResultData getQuestion(){

        return ResultData.success();
    }
}
